package com.palm.hubo2o.model;

import java.util.Arrays;
import java.util.HashMap;

/**
 * Created by dest1 on 2015/10/30.
 */
public class Omit implements Comparable<Omit> {
    public String prizeBalls;
    public long issueNo;
    public HashMap<String, Integer> omitMap;
    private int[] intBalls;

    /**
     * 格式化球号并排序
     */
    public int[] formatBalls() {
        if (intBalls == null) {
            String[] ss = prizeBalls.replaceAll("[^0-9]", " ").split(" ", -1);
            intBalls = new int[ss.length];
            for (int i = 0; i < ss.length; i++) {
                intBalls[i] = Integer.parseInt(ss[i]);
            }
        }
        Arrays.sort(intBalls);
        return intBalls;

    }

    @Override
    public int compareTo(Omit another) {
        if (this.issueNo > another.issueNo)
            return 1;
        else if (this.issueNo == another.issueNo)
            return 0;
        return -1;
    }
}
